/* 
 * File:   RotationCorrectorTest.cpp
 * Author: Guilherme Monteiro
 *
 */

#include "RotationCorrectorTest.h"

/*
 * Simple C++ Test Suite
 */

void RotationCorrectorTest::testCorrectsRotation() {
    IplImage* img = cvCreateImage(cvSize(20,30), IPL_DEPTH_8U, 1);

    for(int y = 0; y < img->height; y++) {
        uchar* ptr2 = (uchar*)(img->imageData + y*img->widthStep); // line of pixels
        for(int x = 0; x < img->width; x++) {
             if(x == y) {
                 ptr2[x] = 255;
             }
        }
    }

    RotationCorrector* corrector = new RotationCorrector();
    corrector->correctsRotation(img);
    if ((int)corrector->getAngleOfRotation() != 45) {
        std::cout << "%TEST_FAILED% time=0 testname=testCorrectsRotation (RotationCorrectorTest) message=error message sample" << std::endl;
    }
    
    cvReleaseImage(&img);
}

